const cssCdnUrlList = ['//at.alicdn.com/t/c/font_2298093_rnp72ifj3ba.css', 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css']
function setCssCdn() {
  cssCdnUrlList.map((v) => {
    const link = document.createElement('link')
    link.rel = 'stylesheet'
    link.href = v
    link.crossOrigin = 'anonymous'
    document.getElementsByTagName('head')[0].appendChild(link)
  })
}

const jsCdnUrlList = []
function setJsCdn() {
  jsCdnUrlList.map((v) => {
    const script = document.createElement('script')
    script.src = v
    script.crossOrigin = 'anonymous'
    document.getElementsByTagName('head')[0].appendChild(script)
  })
}

const initCdn = {
  cssCdn: () => setCssCdn(),
  jsCdn: () => setJsCdn()
}

export default initCdn
